package cn.zy.management;

import java.util.ArrayList;
import java.util.HashSet;
import java.util.List;
import java.util.Set;

public class StringPair {

	public StringPair() {
		firstList = new ArrayList<String>();
		secondList = new ArrayList<String>();
	}
	
	public void put(String first, String second) {
		firstList.add(first);
		secondList.add(second);
	}
	
	public int size() {
		return firstList.size();
	}
	
	public String[] get(int index) {
		String[] result = new String[2];
		result[0] = firstList.get(index);
		result[1] = secondList.get(index);
		
		return result;
	}
	
	public List<String> getFirstList() {
		return this.firstList;
	}
	
	public List<String> getSecondList() {
		return this.secondList;
	}
	
	public Set<String> getFirstListSet() {
		HashSet<String> set = new HashSet<String>();
		set.addAll(firstList);
		
		return set;
	}
	
	public Set<String> getSecondListSet() {
		HashSet<String> set = new HashSet<String>();
		set.addAll(secondList);
		
		return set;
	}
	
	public boolean contains(String first, String second) {
		for (int i = 0; i < firstList.size(); i++) {
			if (first.equals(firstList.get(i)) && second.equals(secondList.get(i)))
				return true;
		}
		return false;
	}
	
	private List<String> firstList;
	private List<String> secondList;
}
